from module.static_module.parent.view import SubWindowView
from tools.view import *


class DownloadMKDataView(SubWindowView):
    def __init__(self, main_window_view):
        super().__init__(main_window_view)
        self.class_name = Module.DownloadMKData.value
        self.title_frame = tk.Frame(self.frame)
        self.title_frame.pack()
        tk.Label(self.title_frame, text=self.class_name).pack()

    def create_layout_init(self):
        # 绘制标签、内容组件
        # 配置参数
        now_model_name = self.main_window_view.master.file_manager.now_model_name
        mk_data_folder_ls = self.main_window_view.master.dynamic_module_model_dc[self.main_window_view.master.file_manager.now_dynamic_module].mk_data_folder_ls
        symbol_ls = self.main_window_view.master.dynamic_module_model_dc[self.main_window_view.master.file_manager.now_dynamic_module].symbol_ls
        k_interval_ls = self.main_window_view.master.dynamic_module_model_dc[self.main_window_view.master.file_manager.now_dynamic_module].k_interval_ls

        start_time_ls = self.main_window_view.master.dynamic_module_model_dc[self.main_window_view.master.file_manager.now_dynamic_module].start_time_ls
        end_time_ls = self.main_window_view.master.dynamic_module_model_dc[self.main_window_view.master.file_manager.now_dynamic_module].end_time_ls
        retry_time_ls = self.main_window_view.master.dynamic_module_model_dc[self.main_window_view.master.file_manager.now_dynamic_module].retry_time_ls
        label_config = [
            [LabelMember.ModelName, WidgetCategory.Label, [now_model_name], [0]],
            [LabelMember.MkDataFolder, WidgetCategory.Entry, mk_data_folder_ls, [0]],
            [LabelMember.SymbolName, WidgetCategory.Entry, symbol_ls, [0]],
            [LabelMember.KInterval, WidgetCategory.Entry, k_interval_ls, [0]],
            [LabelMember.StartTime, WidgetCategory.Entry, start_time_ls, [0]],
            [LabelMember.EndTime, WidgetCategory.Entry, end_time_ls, [0]],
            [LabelMember.RetryTime, WidgetCategory.Entry, retry_time_ls, [0]]
        ]
        button_config = [
            [ButtonMember.Ok, WidgetCategory.Button, None]
        ]
        self.auto_layout = AutoLayout(self.frame, label_config, button_config)
        self.auto_layout.button_command(self)


